
import { State } from "../../";

export interface IAskToTopOptions {

    /** 任务id */
    id: string
}

/** 任务置顶 */
export async function askToTop(s: State, o?: IAskToTopOptions) {
    if (!o) return;
    const { id } = o;

    const l = [...s.taskInfo.list];
    const t = l.filter(e => e.id === id)[0]
    const p = l.indexOf(t)

    l.splice(p, 1);
    l.push(t);
    l.forEach((e, i) => { e.zIndex = i })

    t.minimize = false;

    s.taskInfo.list = [...s.taskInfo.list];
}
